home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1994
/
MacHack 1994.toast
/
MacHack™94
/
Talks & Papers
/
Michael D. Crawford↵
/
Word Services SDK 1.0.5
/
Writeswell Jr. Source
/
Options.c
< prev
next >
Wrap
Text File
|
1992-09-25
|
2KB
|
91 lines
/* Options.c
* Handle options dialog for Writeswell Jr.
* ©1992 Working Software, Inc.
* This source code is copyrighted. Permission is granted to use the Word Services
* portion of the Writeswell Jr. source code in your own programs, but you
* may not distribute the Writeswell Jr. word-processor code as a
* commercial product. If you modify the code, please do not call it
* Writeswell Jr. (or Writeswell.) This will ensure that people understand the
* program and don’t have to deal with a number of different versions with
* who-knows-what going on in the code.
*
* Writeswell Jr. and Writeswell are trademarks of Working Software, Inc.
* 18 Aug 92 Mike Crawford
*/
#include "TBConstants.h"
#include "TBGlobals.h"
#include "OutlineButton.h"
#include "Options.h"
#include "Prefs.h"
#include "Gripe.h"
void OptionsDialog( void )
{
DialogPtr optDlg;
short item;
short kind;
Handle h;
Rect r;
long num;
Boolean sendByList;
ControlHandle listHdl;
ControlHandle tblHdl;
WWJrPrefsHdl prefHdl;
prefHdl = GetPrefHandle();
if ( !prefHdl ){
Gripe( "\pCannot get preferences handle" );
return;
}
optDlg = GetNewDialog( rOptionsID, (Ptr)NULL, (WindowPtr)-1 );
if ( !optDlg )
return;
GetDItem( optDlg, kODSendText, &kind, &listHdl, &r );
GetDItem( optDlg, kODSendTable, &kind, &tblHdl, &r );
/* Set up a user proc to draw the default outline */
GetDItem( optDlg, kODDefUser, &kind, &h, &r );
SetDItem( optDlg, kODDefUser, kind, (Handle)OutlineButton, &r );
sendByList = (*prefHdl)->sendByList;
if ( sendByList )
SetCtlValue( listHdl, 1 );
else
SetCtlValue( tblHdl, 1 );
do {
ModalDialog( (ProcPtr)NULL, &item );
switch ( item ){
case kODSendText:
sendByList = true;
SetCtlValue( listHdl, 1 );
SetCtlValue( tblHdl, 0 );
break;
case kODSendTable:
sendByList = false;
SetCtlValue( listHdl, 0 );
SetCtlValue( tblHdl, 1 );
break;
}
} while ( item != kODCancel && item != kODOk );
if ( item == kODCancel ){
DisposDialog( optDlg );
return;
}
(*prefHdl)->sendByList = sendByList;
ChangedResource( prefHdl );
WriteResource( prefHdl );
DisposDialog( optDlg );
return;
}